import request from './request'
import type { ApiResponse } from '@/model/common-model'

export interface DashboardStats {
  projectCount: number
  deployCount: number
  successCount: number
  failCount: number
}

export interface DeployRecord {
  id: string
  projectName: string
  environment: string
  status: string
  createTime: string
}

/**
 * 获取仪表盘统计数据
 */
export function getDashboardStatistics(): Promise<ApiResponse<DashboardStats>> {
  return request({
    url: '/api/dashboard/statistics',
    method: 'get'
  })
}

/**
 * 获取最近部署记录
 */
export function getRecentDeployments(): Promise<ApiResponse<DeployRecord[]>> {
  return request({
    url: '/api/dashboard/recent-deployments',
    method: 'get'
  })
}
